<?php global $user;
?>
<div class="user_content">
    <?php
    if (isset($data->name)) {
        $user_profile = content_profile_load('profile', $data->uid);
        if ($user_profile->field_firstname[0]['value'] != '' || $user_profile->field_lastname[0]['value'] != '')
            echo '<h3>Hello, ' . $user_profile->field_firstname[0]['value'] . ' ' . $user_profile->field_lastname[0]['value'] . '</h3>';
        else
            echo '<h3>Hello, ' . $user->name . '</h3>';
    }
    ?>
    <?php
    $destination = '';
    $login_form = drupal_get_form('user_login_block');
    if (isset($_SESSION['organization_join'])) {
        $destination = '?destination=node/' . $_SESSION['organization_join'];
    } else {
        //removing the register button
        if ($GLOBALS['base_path'] == '/fundraisingmagsdev/')
            $login_form = str_replace('<li class="first"><a href="/fundraisingmagsdev/user/register" title="Create a new user account.">Create new account</a></li>', '', $login_form);
        else
            $login_form = str_replace('<li class="first"><a href="/user/register" title="Create a new user account.">Create new account</a></li>', '', $login_form);
    }
    $login_link = url('user/login', array('absolute' => false));
    $login_link = $login_link . $destination;
    if (isset($data->name)) {
        echo '<a id="logout_link" href="' . base_path() . 'logout">Logout</a>';
    } else {
        //echo '<a id="login_link" href="' . base_path() . 'user/login">Login</a>';
        print '<a href="' . $login_link . '" class="login_link">Login</a>';
        print "<div id='loginWrapper' title='Superior Plan'><p>Making a Difference Online</p><br/>" . $login_form . "</div>";
    }
    ?>
</div>
